package model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

public class Order implements Collection<Item>, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1299247074995830102L;
	
	private Customer customer;
	private List<Item> list;
	private String date;
	
	/**
	 * constructor
	 * @param customer
	 * @param date
	 */
	public Order(Customer customer, String date){
		this.customer = customer;
		this.date = date;
		list = new ArrayList<Item>();
	}
	
	/**
	 * constructor
	 * @param customer
	 * @param date
	 * @param A collection of orders
	 */
	public Order(Customer customer, String date, Collection<Item> c){
		this.customer = customer;
		this.date = date;
		this.list = new ArrayList<Item>(c);
	}
	
	/**
	 * constructor
	 * @param customer
	 * @param date
	 * @param an initial size
	 */
	public Order(Customer customer, String date, int i){
		this.customer = customer;
		this.date = date;
		this.list = new ArrayList<Item>(i);
	}

	/**
	 * getters and setters
	 */
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	
	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}
	
	/**
	 * overridden collection methods
	 */
	@Override
	public boolean add(Item arg0) {
		return list.add(arg0);
	}

	@Override
	public boolean addAll(Collection<? extends Item> arg0) {
		return list.addAll(arg0);
	}

	@Override
	public void clear() {
		list.clear();
	}

	@Override
	public boolean contains(Object arg0) {
		return list.contains(arg0);
	}

	@Override
	public boolean containsAll(Collection<?> arg0) {
		return list.containsAll(arg0);
	}

	@Override
	public boolean isEmpty() {
		return list.isEmpty();
	}

	@Override
	public Iterator<Item> iterator() {
		return list.iterator();
	}

	@Override
	public boolean remove(Object arg0) {
		return list.remove(arg0);
	}

	@Override
	public boolean removeAll(Collection<?> arg0) {
		return list.removeAll(arg0);
	}

	@Override
	public boolean retainAll(Collection<?> arg0) {
		return list.retainAll(arg0);
	}

	@Override
	public int size() {
		return list.size();
	}

	@Override
	public Object[] toArray() {
		return list.toArray();
	}

	@Override
	public <T> T[] toArray(T[] arg0) {
		return list.toArray(arg0);
	}
	
}
